<template>
	<view class="container">
		<view class="header">已领取的人</view>
		<view class="list">
			<view v-for="item in orderList" :key="item.id">
				<view class="item">
					<view class="info">
						<view class="name">{{item.name}}</view>
						<view class="phone">{{item.phone}}</view>
					</view>
					<view class="time">领取时间：{{item.show_time}}</view>
					<view class="time" v-if="item.is_pay===1">订单编号：{{item.order_no}}</view>
					<view class="orderFooter">
						<view class="shareBtn" @click="toOrder(item.id)" v-if="item.is_pay===0">去支付</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		giftReceiveList,
		createGiftOrder
	} from "@/common/api.js";
	export default {
		data() {
			return {
				gift_id: 0,
				orderList: []
			}
		},
		onLoad(option) {
			let gift_id = option.gift_id
			this.gift_id = gift_id
		},
		onShow() {
			this.receiveList()
		},
		methods: {
			toOrder(id){
				createGiftOrder(this, {
					gift_order_id: id
				})
			},
			receiveList() {
				giftReceiveList(this, {
					gift_id: this.gift_id,
					page: 1,
					limit: 10
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		height: 100vh;
	}

	.container {
		min-height: 100%;
		background-color: #efefef;
	}
	.header{
		height: 60rpx;
		background-color: #FFFFFF;
		line-height: 60rpx;
		padding: 0 20rpx;
		font-size: 24rpx;
		margin-bottom: 10rpx;
	}
	.list{
		padding-bottom: 10rpx;
		.item{
			font-size: 24rpx;
			padding: 10rpx 20rpx;
			background-color: #FFFFFF;
			margin: 0 10rpx 10rpx 10rpx;
			border-radius: 10rpx;
			.info{
				display: flex;
				height: 50rpx;
				align-items: center;
				.name{
					flex: 1;
				}
				.phone{
					color: #666666;
				}
			}
			.time{
				color: #999999;
				height: 50rpx;
				line-height: 50rpx;
			}
			.orderFooter {
				border-top: 1px solid #f7f7f7;
				overflow: hidden;
				padding: 10rpx;
				.shareBtn {
					float: right;
					background-color: #20cbd4;
					color: #ffffff;
					font-size: 24rpx;
					height: 46rpx;
					line-height: 46rpx;
					padding: 0 15rpx;
					border-radius: 8rpx;
					margin-left: 20rpx;
				}
			}
		}
	}
</style>
